<template>
  <div class="app-product-details">
    <div class="app-main">
      <mt-swipe :auto="4000">
        <mt-swipe-item v-for="(item,index) in slidebox" :key="index">
          <img :src="item.thumb">
        </mt-swipe-item>
      </mt-swipe>
      <div class="product-content">
        <div class="product-price">￥<span class="price">{{resData.commattribPrice}}</span><span class="item-factory">{{resData.factory}}</span></div>
        <div class="product-title">{{resData.commAttribName}}</div>
      </div>

      <div class="module-body">
        <div class="title">产品信息</div>
        <dl class="details">
          <dd class="item"><span class="item-addon">OEM编码：</span><span class="item-content">{{resData.originalCode}}</span></dd>
          <dd class="item"><span class="item-addon">商品编码：</span><span class="item-content">{{resData.commAttribCode}}</span></dd>
          <dd class="item"><span class="item-addon">商品分类：</span><span class="item-content">{{resData.classify}}</span></dd>
          <dd class="item"><span class="item-addon">规 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 格：</span><span class="item-content">{{resData.commLength}}*{{resData.commWidth}}</span></dd>
        </dl>
      </div>

      <div class="button-content-bottom">
        <ul class="module-left">
          <li class="item">
            <a class="action-phone" href="tel:400-968-3360">
            <span class="iconfont icon-kefuzhuanhuan"></span>
            电话咨询
              </a>
          </li>
          <li class="item">
            <span class="iconfont icon-zaixiankefu"></span>
            在线客服
          </li>
        </ul>
        <mt-button type="primary" @click.native="handleOpen">立即预约</mt-button>
      </div>

      <mt-popup
        v-model="popupYuyue"
        position="bottom"
        class="popup-yuyue">
        <div class="button-content">
            <mt-button type="default" @click="popupYuyue = false">取消</mt-button>
            <mt-button type="primary" @click="">确定</mt-button>
        </div>

      </mt-popup>
    </div>
  </div>
</template>
<script>
  import { Header,Swipe, SwipeItem,MessageBox } from 'mint-ui';
  export default{
    data () {
      return {
        popupYuyue:false,
        resData:'',
        slidebox:[
          {
            id:1,
            thumb:'./static/img/img-none.jpg'
          },
        ],
      }
    },
    beforeDestroy: function() {
      document.body.removeAttribute("class","add_bg");
    },
    mounted(){
      document.getElementsByTagName("body")[0].className="add_bg";
      this.getData();
    },
    methods:{

      getData(){
        var params = new URLSearchParams();
        params.append('form.commAttribId', this.$route.query.id);

        params.append('plateFormFlag','0101');
        this.$axios({
          method: 'post',
          url:'gp/app/commattribApp!ajaxCommAttrib.do',
          data:params,
        }).then((res)=>{
          console.log(res)
        this.resData=res.data
      });
      },
      handleOpen(){
//        this.popupYuyue=true;

        const orderList=[];
        const item={
          commattribId:this.$route.query.id,
          commAttribName:this.resData.commAttribName,
          commAttribCode: this.resData.commAttribCode,
          commattribPrice: this.resData.commattribPrice,
          carModelId: this.resData.carModelId,
          carModel: this.resData.brand+'>'+this.resData.carModel,
          factory: this.resData.factory,
          count: 1,
          serviceAttr:[
//            {
//              name:'工时费',
//              price:150
//            }
          ],
        }
        orderList.push(item)
        sessionStorage.removeItem('orderList');
        sessionStorage.setItem('orderList',JSON.stringify(orderList))
        this.$router.push({path:'/store-inquiry-order',query: {id:this.$route.query.id}})
      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style>
  .app-product-details{
    background: #fff;
  }
  .app-product-details .app-main{
    padding:0 0 50px;
  }
  .app-product-details .mint-swipe{
    background: #fff;
    height:280px;
    text-align: center;
    border-bottom:1px solid #eee;
  }
  .app-product-details .mint-swipe img{
    height: 100%;
  }
  .app-product-details .product-content{
    padding:14px 16px;
  }
  .app-product-details .product-price{
  padding:0 0 8px;
   color: red;
   font-size: 16px;
 }
  .app-product-details .product-price .price{
    font-size: 20px;
  }
  .app-product-details .product-title{
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
  }
  .app-product-details .module-body .title{
    background: #f5f5f5;
    padding:12px 0;
    font-size: 15px;
    text-align: center;
  }
  .app-product-details .module-body .title:before {
    background: #ddd;
    display: inline-block;
    vertical-align: middle;
    width:60px;
    height: 1px;
    content: '';
    margin-right:16px; }
  .app-product-details .module-body .title:after {
    background: #ddd;
    display: inline-block;
    vertical-align: middle;
    width:60px;
    height: 1px;
    content: '';
    margin-left: 16px; }
  .app-product-details .module-body .details {
    padding:14px 16px;
    font-size: 15px;
    color: #999;
    margin: 0; }
  .app-product-details .module-body .details .item {
    margin: 0;
    padding:4px 0;
  }
  .app-product-details .module-body .details .item-block {
    display: inline-block;
    margin-right: 1.7rem; }
  .app-product-details .module-body .details .item-addon {
    display: table-cell;
    vertical-align: top;
    width: 90px;
    color: #333; }
  .app-product-details .module-body .details .item-content {
    display: table-cell;
    vertical-align: top; }
  .app-product-details .button-content-bottom{
    background: #fff;
    padding:6px 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    display: flex;
    height: 56px;
    box-shadow: 0px -6px 4px 0px rgba(0, 0, 0, 0.03);

  }
  .app-product-details .module-left{
    width:44%;
    display: flex;
    padding:0 6px;
    align-items: center;
    justify-content: center;

  }
  .app-product-details .module-left .item{
    width: 50%;
    text-align: center;
    color: #666;

  }
  .app-product-details .module-left .iconfont{
    display: block;
    margin:0 0 2px;
    text-align: center;
  }
  .app-product-details .button-content-bottom .mint-button{
    display: flex;
    flex: 1;
    width:56%;
    border-radius:3px;
    justify-content: center;
    font-size: 16px;
    box-shadow: none;
    height: 44px;

  }

  .app-product-details .popup-yuyue{
    width: 100%;
    min-height: 200px;
    overflow: auto;
  }
  .app-product-details .popup-yuyue .button-content{
    position: fixed;
    bottom: 0;
    left: 0;
    right:0;
    display: flex;
  }
  .app-product-details .popup-yuyue .button-content .mint-button{
    display: flex;
    flex: 1;
    border-radius: 0;
    justify-content: center;
    font-size: 16px;
    box-shadow: none;
    height: 50px;

  }
  .app-product-details .item-factory{
    border: 1px solid red;
    margin-left: 8px;
    padding:0 4px;
    border-radius: 3px;
    font-size: 13px;
    letter-spacing:1px;
  }
</style>
